package co.com.coomeva.adminEvaluacion.modelo.persistencia;

import java.util.Date;
import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hibernate.LockMode;
import org.hibernate.Query;
import org.hibernate.criterion.Example;

import co.com.coomeva.adminEvaluacion.modelo.entidades.EdCalificacionTipoab;

/**
 * A data access object (DAO) providing persistence and search support for
 * EdCalificacionTipoab entities. Transaction control of the save(), update()
 * and delete() operations can directly support Spring container-managed
 * transactions or they can be augmented to handle user-managed Spring
 * transactions. Each of these methods provides additional information for how
 * to configure it for the desired type of transaction control.
 * 
 * @see co.com.coomeva.adminEvaluacion.modelo.entidades.EdCalificacionTipoab
 * @author MyEclipse Persistence Tools
 */

public class EdCalificacionTipoabDAO extends BaseHibernateDAO {
	private static final Log log = LogFactory
			.getLog(EdCalificacionTipoabDAO.class);
	// property constants
	public static final String ITEM21 = "item21";
	public static final String ITEM22 = "item22";
	public static final String ITEM23 = "item23";
	public static final String ITEM24 = "item24";
	public static final String ITEM25 = "item25";
	public static final String ITEM31 = "item31";
	public static final String ITEM32 = "item32";
	public static final String ITEM33 = "item33";
	public static final String ITEM34 = "item34";
	public static final String ITEM35 = "item35";
	public static final String ITEM11 = "item11";
	public static final String ITEM12 = "item12";
	public static final String ITEM13 = "item13";
	public static final String ITEM14 = "item14";
	public static final String ITEM15 = "item15";
	public static final String ITEM41 = "item41";

	public void save(EdCalificacionTipoab transientInstance) {
		log.debug("saving EdCalificacionTipoab instance");
		try {
			getSession().save(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}

	public void delete(EdCalificacionTipoab persistentInstance) {
		log.debug("deleting EdCalificacionTipoab instance");
		try {
			getSession().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}

	public EdCalificacionTipoab findById(java.lang.Long id) {
		log.debug("getting EdCalificacionTipoab instance with id: " + id);
		try {
			EdCalificacionTipoab instance = (EdCalificacionTipoab) getSession()
					.get(
							"co.com.coomeva.adminEvaluacion.modelo.entidades.EdCalificacionTipoab",
							id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}

	public List findByExample(EdCalificacionTipoab instance) {
		log.debug("finding EdCalificacionTipoab instance by example");
		try {
			List results = getSession()
					.createCriteria(
							"co.com.coomeva.adminEvaluacion.modelo.entidades.EdCalificacionTipoab")
					.add(Example.create(instance)).list();
			log.debug("find by example successful, result size: "
					+ results.size());
			return results;
		} catch (RuntimeException re) {
			log.error("find by example failed", re);
			throw re;
		}
	}

	public List findByProperty(String propertyName, Object value) {
		log.debug("finding EdCalificacionTipoab instance with property: "
				+ propertyName + ", value: " + value);
		try {
			String queryString = "from EdCalificacionTipoab as model where model."
					+ propertyName + "= ?";
			Query queryObject = getSession().createQuery(queryString);
			queryObject.setParameter(0, value);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find by property name failed", re);
			throw re;
		}
	}

	public List findByItem21(Object item21) {
		return findByProperty(ITEM21, item21);
	}

	public List findByItem22(Object item22) {
		return findByProperty(ITEM22, item22);
	}

	public List findByItem23(Object item23) {
		return findByProperty(ITEM23, item23);
	}

	public List findByItem24(Object item24) {
		return findByProperty(ITEM24, item24);
	}

	public List findByItem25(Object item25) {
		return findByProperty(ITEM25, item25);
	}

	public List findByItem31(Object item31) {
		return findByProperty(ITEM31, item31);
	}

	public List findByItem32(Object item32) {
		return findByProperty(ITEM32, item32);
	}

	public List findByItem33(Object item33) {
		return findByProperty(ITEM33, item33);
	}

	public List findByItem34(Object item34) {
		return findByProperty(ITEM34, item34);
	}

	public List findByItem35(Object item35) {
		return findByProperty(ITEM35, item35);
	}

	public List findByItem11(Object item11) {
		return findByProperty(ITEM11, item11);
	}

	public List findByItem12(Object item12) {
		return findByProperty(ITEM12, item12);
	}

	public List findByItem13(Object item13) {
		return findByProperty(ITEM13, item13);
	}

	public List findByItem14(Object item14) {
		return findByProperty(ITEM14, item14);
	}

	public List findByItem15(Object item15) {
		return findByProperty(ITEM15, item15);
	}

	public List findByItem41(Object item41) {
		return findByProperty(ITEM41, item41);
	}

	public List findAll() {
		log.debug("finding all EdCalificacionTipoab instances");
		try {
			String queryString = "from EdCalificacionTipoab";
			Query queryObject = getSession().createQuery(queryString);
			return queryObject.list();
		} catch (RuntimeException re) {
			log.error("find all failed", re);
			throw re;
		}
	}

	public EdCalificacionTipoab merge(EdCalificacionTipoab detachedInstance) {
		log.debug("merging EdCalificacionTipoab instance");
		try {
			EdCalificacionTipoab result = (EdCalificacionTipoab) getSession()
					.merge(detachedInstance);
			log.debug("merge successful");
			return result;
		} catch (RuntimeException re) {
			log.error("merge failed", re);
			throw re;
		}
	}

	public void attachDirty(EdCalificacionTipoab instance) {
		log.debug("attaching dirty EdCalificacionTipoab instance");
		try {
			getSession().saveOrUpdate(instance);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}

	public void attachClean(EdCalificacionTipoab instance) {
		log.debug("attaching clean EdCalificacionTipoab instance");
		try {
			getSession().lock(instance, LockMode.NONE);
			log.debug("attach successful");
		} catch (RuntimeException re) {
			log.error("attach failed", re);
			throw re;
		}
	}
}